<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>员工列表</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">

<link rel="stylesheet" type="text/css" href="{:C('WEB_URL')}Public/business/style/base.css" />
<link rel="stylesheet" type="text/css" href="{:C('WEB_URL')}Public/business/style/base.css" />
<link rel="stylesheet" type="text/css" href="{:C('WEB_URL')}Public/business/style/style.css" />
<link rel="stylesheet" type="text/css" href="{:C('WEB_URL')}Public/business/style/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="{:C('WEB_URL')}Public/business/style/mui.min.css">
<link rel="stylesheet" type="text/css" href="{:C('WEB_URL')}Public/business/style/app.css" />
<script type="text/javascript" charset="UTF-8" src="{:C('WEB_URL')}Public/business/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="{:C('WEB_URL')}Public/business/js/bootstrap.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="{:C('WEB_URL')}Public/business/js/script.js"></script>
<script type="text/javascript" charset="UTF-8" src="{:C('WEB_URL')}Public/business/js/mui.min.js"></script>
<style>
.mui-content #pullrefresh{width:100%;max-width:640px;margin:50px auto;}
</style>
</head>
<body>
<div id="box">
	<div class="navbar navbar-default navbar-fixed-top">
	  <header>
	   <h1><a href="index.html"><span class="glyphicon glyphicon-menu-left"></span></a></h1>
	   <p class="title">员工列表</p>
	  </header>
	 </div><!--navbar-fixed-top-->
	<!--下拉刷新容器-->
	<div class="mui-content">
	<div id="pullrefresh" class="mui-scroll-wrapper">
		<div class="mui-scroll">
			<!--数据列表-->
			<ul class="mui-table-view" id='ul'>
				<volist name='data' id="vo">
				<li class="mui-table-view-cell">
					<div class="mui-slider-right mui-disabled permission" >
					 <a class="mui-btn mui-btn-grey mui-icon buts"  atr='{$vo.id}' atrr="2" >禁用</a>
					 <a class="mui-btn mui-btn-yellow mui-icon but" atr='{$vo.id}' atrr="1">授权</a>
				
				    </div>
					<div class="mui-slider-handle staff" style="margin:0">
					  <div class="staffList">
				       <div class="staffLeft">
					    <img src="{:C('WEB_URL')}Public/business/images/member_03.jpg" />
				       </div><!--staffLeft-->
				      <div class="staffCenter">
				       <p class="memberName">{$vo.nickname}</p>
					   <p>NO.{$vo.id}</p>
					   <p><img src="{:C('WEB_URL')}Public/business/images/staff_03.jpg" />{$vo.tel}</p>
				      </div><!--staffCenter-->
				      <div class="staffRight">
					 
					   	<if condition="$vo[purview] eq 1">
					   	<p><img src="{:C('WEB_URL')}Public/business/images/staff_07.jpg" /></p>
					   	<else />
					   	<p><img src="{:C('WEB_URL')}Public/business/images/jycon.png" /></p>
						</if>
				      </div><!--staffRight-->
				    </div><!--staffList-->
				   </div>
				</li>
				</volist>
			</ul>
		</div>
	</div> 
	</div>
	<div class="navbar navbar-default navbar-fixed-bottom">
	   <footer id="foot">
	    <dl>
	     <dt><a href="index.html"><img src="{:C('WEB_URL')}Public/business/images/index_06.jpg" /></a></dt>
	     <dd><a href="index.html">首页</a></dd>
	    </dl>
	    <dl>
	     <dt><a href="pullrefresh_sub.html"><img src="{:C('WEB_URL')}Public/business/images/footer_01.jpg" /></a></dt>
	     <dd><a href="pullrefresh_sub.html" class="current">员工管理</a></dd>
	    </dl>
	    <dl>
	     <dt><a href="manage.html"><img src="{:C('WEB_URL')}Public/business/images/deal_09.jpg" /></a></dt>
	     <dd><a href="manage.html">会员管理</a></dd>
	    </dl>
   </footer>
    </div><!--/navbar-->
</div><!--box-->
<!--会员卡授权成功弹出页面 -->
<div id="popup"><a href="javascript:;" class="a_click">
  <div id="click_div">
   <div id="dialog">
	<h3><img src="{:C('WEB_URL')}Public/business/images/paysuc_03.jpg" /></h3>
	<p>恭喜您，授权成功！</p>
  </div>
 </div></a>
</div>
<!--会员卡授权成功弹出页面 End-->
<!--会员卡禁用成功弹出页面 -->
<div id="popup"><a href="javascript:;" class="a_click">
  <div id="click_divs">
   <div id="dialog">
	<h3><img src="{:C('WEB_URL')}Public/business/images/index_01.jpg" /></h3>
	<p>恭喜您，禁用成功！</p>
  </div>
 </div></a>
</div>
 <!--会员卡禁用成功弹出页面 End-->
 <!--会员卡审核中弹出页面 -->
<!--<div id="popup"><a href="javascript:;" class="a_click">
  <div id="click_div2">
   <div id="dialog">
	<h3><img src="{:C('WEB_URL')}Public/business/images/index_01.jpg" /></h3>
	<p>审核中！</p>
  </div>
 </div></a>
</div>-->
 <!--会员卡审核中弹出页面 End-->
<script type="text/javascript">
$('#ul li a').on("tap",function(){
		var permission=$(this).attr('atr');
		var status=$(this).attr('atrr');
	
		$.ajax({
			type:"post",
			url:"setPermissione",
			dataType: "json",
			data: 'permission='+permission+ "&status=" + status,
			success:function(data){
				$.each(data, function(index, item){
					if(item==1){
						var box=document.getElementById('click_div');
						box.style.display='block';
						
						
   					 setTimeout("location.reload()",2000);

				
					}else{
						var box=document.getElementById('click_divs');
						box.style.display='block';
						
						
    					setTimeout("location.reload()",2000);

						
					}
					
					
				})
			}
						  
		});
		})

//最下面点击效果
$('#foot dl').on("touchstart",function(){
  // alert(1);
  $('#foot dl').css("background-color","#fff")
  $(this).css("background-color","#ddd")
})
$('#foot dl').on("touchend",function(){
  // alert(1);
  $('#foot dl').css("background-color","#fff")

})

$('ul li').on("touchstart",function(){
  // alert(1);
  $('ul li').css("background-color","#fff")
  $(this).css("background-color","#ddd")
})
$('ul li').on("touchend",function(){
  // alert(1);
  $('ul li').css("background-color","#fff")

})
//(function($){
//	init();
	//禁用弹出层
//	$.ready(function(){
//		var contents = $(".buts");
//		var boxs1 = $("#click_divs")[0];
//		console.log(contents);
//		contents.each(function(i,buts){
//			var permission =$(this).html();
//				alert(permission);
//			buts.addEventListener('tap',function(){
////				 $("#click_divs").fadeIn();
//				
////				 var box=document.getElementById('click_divs');
////				 box.style.display='block';
//				 
//			})
//		});
//		boxs1.addEventListener('tap',function(){
//			this.style.display = 'none';
//		})
//	});
	//授权弹出层
//	$.ready(function(){
//		var content = $(".but");
//		var box1 = $("#click_div")[0];
//		console.log(content);
//		content.each(function(i,but){
//			but.addEventListener('tap',function(){
////				 $("#click_divs").fadeIn();
//				 var box=document.getElementById('click_div');
//				 box.style.display='block';
//				 
//			})
//		});
//		box1.addEventListener('tap',function(){
//			this.style.display = 'none';
//		})
//	});
//	//审核中弹出层
//	$.ready(function(){
//		var contenta = $(".but2");
//		var box2 = $("#click_div2")[0];
//		console.log(contenta);
//		contenta.each(function(i,but2){
//			but2.addEventListener('tap',function(){
////				 $("#click_divs").fadeIn();
//				 var box=document.getElementById('click_div2');
//				 box.style.display='block';
//				 
//			})
//		});
//		box2.addEventListener('tap',function(){
//			this.style.display = 'none';
//		})
//	});
//})(mui);
//微信判断header是否显示
if(isWeiXin()){ 
//alert("====");
$(".title").hide();
} 
else{
//alert("+++++");
}
			/*刷新和加载更多*/
			mui.init({
				pullRefresh: {
					container: '#pullrefresh',
					down: {
						callback: pulldownRefresh
					},
					up: {
						contentrefresh: '正在加载...',
						callback: pullupRefresh
					}
				}
			});
			var count = 0;
			/**
			 * 下拉刷新具体业务实现
			 */
			function pulldownRefresh() {
				setTimeout(function() {
					var table = document.body.querySelector('.mui-table-view');
					var cells = document.body.querySelectorAll('.mui-table-view-cell');
					for (var i = cells.length, len = i + 3; i < len; i++) {
						var li = document.createElement('li');
						window.location.reload();
						//下拉刷新，新纪录插到最前面；
						table.insertBefore(li, table.firstChild);
					}
					mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
				}, 1500);
			}
			var count = 0;
			/**
			 * 上拉加载具体业务实现
			 */
			function pullupRefresh() {
				setTimeout(function() {
					mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count > 2)); //参数为true代表没有更多数据了。
					var table = document.body.querySelector('.mui-table-view');
					var cells = document.body.querySelectorAll('.mui-table-view-cell');
					var nums=document.getElementById("ul").children.length;
					$.ajax({
						  type:'POST',
						  url:'employeeRefresh',
						  dataType: "json",
						  data: 'limit='+nums,
						  success:function(data){
						
							$.each(data, function(index, item){
							var li = document.createElement('li');
						li.className = 'mui-table-view-cell';
						li.innerHTML = '<div class="mui-slider-right mui-disabled permission"><a class="mui-btn mui-btn-grey mui-icon buts"  atr="'+item.id+'" atrr="2"">禁用</a><a class="mui-btn mui-btn-yellow mui-icon but" atr="'+item.id+'"atrr="1"">授权</a></div><div class="mui-slider-handle staff" style="margin:0"><div class="staffList"><div class="staffLeft"><img src="{:C('WEB_URL')}Public/business/images/member_03.jpg" /></div><div class="staffCenter"><p class="memberName">'+item.nickname+'</p><p>NO.'+item.id+'</p><p><img src="{:C('WEB_URL')}Public/business/images/staff_03.jpg" />'+item.tel+'</p></div><div class="staffRight"><p>本月累计收款'+item.collection+'次</p><p><img src="{:C('WEB_URL')}Public/business/images/staff_07.jpg" /></p></div></div></div>';
						table.appendChild(li);
                             
                         });
						
						
						  	}
						 })
					
				}, 1500);
			}
			if (mui.os.plus) {
				mui.plusReady(function() {
					setTimeout(function() {
						mui('#pullrefresh').pullRefresh().pullupLoading();
					}, 1000);

				});
			} else {
				mui.ready(function() {
					mui('#pullrefresh').pullRefresh().pullupLoading();
				});
			}
			
			
			
		
</script>
</body>
</html>